extends ./panel.pug

block title
  | #[span.icon-pencil] #{title} #[span.h-panel-name #{name}]

block content
  .input-group.input-group-sm.h-style-group-row
    select.form-control.h-style-group
      each group in groups.sortBy('id')
        option(value=group.id, selected=group.id === style)
          = group.id
    .input-group-btn
      button.btn.btn-default.h-configure-style-group(type='button')
        span.icon-cog(data-toggle='tooltip', title='Configure style group')
  .btn-group.btn-justified.btn-group-sm.h-draw-tools
    .btn-group.btn-group-sm
      button.h-draw.btn.btn-default(
        type='button', data-type='point', data-toggle='tooltip', title='Draw a new point', class=drawingType === 'point' ? 'active' : null)
        | #[span.icon-circle-empty]Point
    .btn-group.btn-group-sm
      button.h-draw.btn.btn-default(
        type='button', data-type='rectangle', data-toggle='tooltip', title='Draw a new rectangle', class=drawingType === 'rectangle' ? 'active' : null)
        | #[span.icon-check-empty]Rectangle
    .btn-group.btn-group-sm
      button.h-draw.btn.btn-default(
        type='button', data-type='polygon', data-toggle='tooltip', title='Draw a new polygon', class=drawingType === 'polygon' ? 'active' : null)
        | #[span.icon-star-empty]Polygon
    .btn-group.btn-group-sm
      button.h-draw.btn.btn-default(
        type='button', data-type='line', data-toggle='tooltip', title='Draw a new line', class=drawingType === 'line' ? 'active' : null)
        | #[span.icon-pencil]Line

  if elements.length
    .h-elements-container
      each element in elements
        - var classes = highlighted[element.id] ? ['h-highlight-element'] : [];
        - element = element.toJSON();
        - var label = (element.label || {}).value || (element.type === 'polyline' ? (element.closed ? 'polygon' : 'line') : element.type);
        .h-element(data-id=element.id, class=classes)
          span.icon-cog.h-edit-element(title='Change style')
          span.h-element-label(title=label) #{label}
          span.icon-cancel.h-delete-element(title='Remove')
